package statemode.state;

/**
 * @author: zh
 * @date: 2021/12/17 16:11
 * @version: 1.0
 */
public class Zh0202GoldMember extends Zh0202Level {
    public Zh0202GoldMember(Zh0202Level level) {
        this.score = level.score;
        this.user = level.user;
    }

    @Override
    public double calcRealAmount() {
        user.setPaidMoney(user.getPaidMoney()*0.8);
        return user.getPaidMoney();
    }

    @Override
    public double changeCredit() {
        this.score -= 8;
        System.out.println("兑换成功，消耗8积分");
        System.out.println("您的积分总额为"+getScore());
        return this.score;
    }

    @Override
    public void checkLevel() {
        if (this.score>=300){
            user.setUserLevel(new Zh0202SilverMember(this));
            System.out.println("恭喜你成功升级为钻石会员");
        }else if (this.score<200){
            user.setUserLevel(new Zh0202OrdinaryMember(this));
        }
    }
}
